<template>
  <maincontainer>
    <n-card v-for="item in companyList" class="w-full">
      <div class="w-full flex justify-between items-center">
        <span class="titletext">{{ item.name }}联系方式</span>
        <n-button size="small" type="success">
          <n-icon size="20">
            <EditTwotone></EditTwotone>
          </n-icon>
          编辑</n-button>
      </div>
      <div class="flex w-full">
        <div class="w-1/4">
          <descriptions :infoList="changename(item)"></descriptions>
        </div>
        <div>

        </div>
      </div>
    </n-card>
    <Edit ref="Editref"></Edit>
  </maincontainer>
</template>

<script setup name="Lxwm" lang="ts">
import Edit from "./model.vue"
import {useRoute, useRouter} from "vue-router";
import {AddOutline} from "@vicons/ionicons5"
import {EditTwotone, PlusOutlined} from "@vicons/antd"
import {DefineComponent, inject, ref} from "vue"

const router = useRouter()
const route = useRoute()
const Editref = ref<DefineComponent | null>(null)
const companyList = ref([
  {
    name: "总公司",
    dianhua1: "123",
    dianhua2: "123",
    dianhua3: "123",
    dianhua4: "123",
    dianhua5: "123",
    dianhua6: "123",
    dizhi: "地址",
    chuanzhen: "123"
  },
])
const companyInfoKey = ref([
  {label: "电话1", key: "dianhua1"},
  {label: "电话2", key: "dianhua2"},
  {label: "电话3", key: "dianhua3"},
  {label: "电话4", key: "dianhua4"},
  {label: "电话5", key: "dianhua5"},
  {label: "电话6", key: "dianhua6"},
  {label: "地址", key: "dizhi"},
  {label: "传真", key: "chuanzhen"},
])
const changename = (companyInfo: any) => {
  return companyInfoKey.value.map(item => {
    return {...item, value: companyInfo[item.key] || "",}
  })
}


// 点击新增公司
const addItem = () => {
  Editref.value && Editref.value.init()
}
const zhucefunc:Function|undefined = inject("zhuceshuaxinfunc")
// 初始化函数
const init = () => {
}

// 初始化区域
init()
zhucefunc && zhucefunc({[route.name!.toString()]:init})
</script>

<style scoped>

</style>